<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<!-- jqgrid-->
<link
	href="${basePath}/css/plugins/jqgriddemo/css/ui.jqgrid-bootstrap.min.css"
	rel="stylesheet" />
<!doctype html>
<html>
<head>
<style type="text/css">
* {
	margin: 0px;
	padding: 0px;
	font-size: 12px;
}
</style>
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeinright">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;风控审核&gt;财务审核二
			</span> <a href="javascript:void(0)"></a>
		</div>
		<div class="ibox-content ibox-zxsearchqu ">
			<div class="row">
				<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
					<div class="row">
						<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
							<label class="sr-only">客户名：</label> <input type="text"
								placeholder="客户名" id="customerName" name="customerName"
								class="form-control">
						</div>
						<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
							<label class="sr-only">业务员：</label> <input type="text"
								placeholder="业务员" id="salesmanName" name="salesmanName"
								class="form-control">
						</div>
					</div>
				</div>
				<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
					<div class="row">
						<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
							<input id="submitTimeStart" name="submitTimeStart"
								placeholder="开始时间" class="laydate-icon form-control">
						</div>
						<label class="hxleft">至</label>
						<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
							<input id="submitTimeEnd" name="submitTimeEnd" placeholder="结束时间"
								class="laydate-icon form-control">
						</div>
					</div>
				</div>
				<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
					<button class="btn dpbtn_blue_null" type="button"
						onclick="query(0,0);">当日</button>
					<button class="btn dpbtn_blue_null" type="button"
						onclick="query(-1,-1);">昨日</button>
					<button class="btn dpbtn_blue_null" type="button"
						onclick="query(-6,0);">近7日</button>
					<button class="zhixcx" type="button" onclick="query();">执行查询</button>
				</div>
			</div>
		</div>
		<div class="ibox-content">
			<div class="jqGrid_wrapper">
				<table id="table_list_1"></table>
				<div id="pager_list_1"></div>
			</div>
		</div>
	</div>

	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>

	<!-- jqGrid -->
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/jquery.jqGrid.min.js"></script>
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/grid.locale-cn.min.js"></script>

	<!-- layerDate plugin javascript -->
	<script src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>


	<!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
	    jQuery(function($){
	    	
	    	//外部js调用
		    laydate({
		        elem: '#submitTimeStart', 
		        event: 'focus' 
		    });
	    	
		    laydate({
		        elem: '#submitTimeEnd', 
		        event: 'focus' 
		    });
	    	
	    	getData();
	    });
	    
	    var getData = function()
	    {
	  var winWidth = $('div.ibox-content').width();
	        var winHeight = document.body.offsetHeight - 300;
	     	var win = winWidth / 7 - 20;
  	 	   $.jgrid.defaults.styleUI = 'Bootstrap';
  	 	   
		  jQuery("#table_list_1").jqGrid
		  ({
			url:'${basePath}/FengKongShenHeController/selectByExtCaiWu?modeId=M_cwshe&statusList=1',
			datatype : "json",
		    postData:
	        {},
	        colNames : [ 'replaceId','busiId','业务提交时间', '订单类型','经销商','经销商等级','客户姓名','贷款额', '部门','业务员','审核状态', '来源',  '锁定人','customerName','customerNo','operatorId'],
	        colModel : [ 
	                    {name: 'replaceId',index: '',width: win,hidden:true},
	                    {name: 'busiId',index: '',width: win,hidden:true},
	                    {name: 'busiConfirmTime',index: '',width: 150,align: "center"},
	                    {name: 'channelTypeName',index: '',width: 130,align: "center"},
	                    {name: 'dealer',index: '',width: 300,align: "center"},
	                    {name: 'dealerLevelDisplay',index: 'BDI.dealerLevel',width: 130,align: "center"},
	                    {name: 'cusName',index: '',width: 130,align: "center"},
	                    {name: 'loanAmount',index: '',width: 130,align: "center",
	                    	formatter:function(a,b,c)
	                    	{
		                       	 return showNumber(a);
		                    }	
	                    },
	                    {name: 'departmentName',index: '',width: 130,align: "center"},
	                    {name: 'salersmanName',index: '',width: 130,align: "center"},
	                    {name: 'statusList',index: '',width: 130,align: "center"},
	                    {name: 'source',index: '',width: 130,align: "center"},
	                    {name: 'operatorName',index: '',width: 130,align: "center"},
	                    {name: 'customerName',index: '',width: win,hidden:true},
	                    {name: 'customerNo',index: '',width: win,hidden:true},
	                    {name: 'operatorId',index: '',width: win,hidden:true}
	                   ],
              mtype : "post",
              height: winHeight,
              width:winWidth,  
              shrinkToFit:false,
              autoScroll: false,
              rowNum: 15,
              rowList: [15, 30, 45],
              viewrecords: true,
              pager: "#pager_list_1",
              hidegrid: false,
              multiselect : false,
              altRows:true,
              altclass:'someClass',
              ondblClickRow:function(rowId)
              {
            	  var row = $("#table_list_1").jqGrid("getRowData",rowId);
            	  if(!row.operatorId || null == row.operatorId || row.operatorId == "" || row.operatorId == "undefined")
            	  {
            	    layer.msg('正在进入，请稍后...',{icon: 16,shade: 0.01});
            	    window.location.href="${basePath}/FengKongShenHeView/getFengKongShenHelist?replaceId="+row.replaceId+"&busiId="+row.busiId+"&modeId=M_cwshe&id="+row.busiId+"&customerName="+row.customerName+"&customerNo="+row.customerNo;   
            	  }
            	  else if(row.operatorId != '${current_user_key.id}')
            	  {
            	    layer.confirm('此审核信息已经被锁定，是否进入？', {
            	  	  btn: ['确定','取消'] //按钮
            	    },function(){
            	  	  layer.msg('正在进入，请稍后...',{icon: 16,shade: 0.01});
            	  	  layer.closeAll();
            	  	  window.location.href="${basePath}/FengKongShenHeView/getFengKongShenHelist?replaceId="+row.replaceId+"&busiId="+row.busiId+"&modeId=M_cwshe&id="+row.busiId+"&customerName="+row.customerName+"&customerNo="+row.customerNo;    
            	    },function(){
            	  	  layer.msg('您已关闭，请确认！', {icon: 6});
            	    });
            	  }
            	  else
            	  {
            	    layer.msg('正在进入，请稍后...',{icon: 16,shade: 0.01});
            	    window.location.href="${basePath}/FengKongShenHeView/getFengKongShenHelist?replaceId="+row.replaceId+"&busiId="+row.busiId+"&modeId=M_cwshe&id="+row.busiId+"&customerName="+row.customerName+"&customerNo="+row.customerNo;   
            	  }
              },
              gridComplete:function(row)
              {
            	  var ids = $("#table_list_1").getDataIDs();
            	  for(var i=0;i<ids.length;i++)
            	  {
            		  var row = $("#table_list_1").getRowData(ids[i]);
            		  if(!row.operatorId || null == row.operatorId || row.operatorId == "" || row.operatorId == "undefined")
              		  {
            			  $('#'+ids[i]).find("td").addClass("dp-grid-deepgrey");
              		  }
            		  else if(row.operatorId == '${current_user_key.id}')
            		  {
            			  $('#'+ids[i]).find("td").addClass("dp-grid-deepgreen");
            		  }
            		  else
            		  {
            			  $('#'+ids[i]).find("td").addClass("dp-grid-deepred");
            		  }
            	  }
              },
              loadComplete:function(datas){
            	  if (datas.flag == "100100") {
                      layer.msg("查询成功!", {icon: 6, time: 1000});
                      return;
                  }
            	  if(datas.flag == '100802') {
    				  top.location.href = thisLoginUrl;
    				  return;
    			  }

            	  layer.msg(datas.message, {icon: 2});
              },
              jsonReader : {
            	  root:"result.rows",
            	  page: "result.page",
            	  total: "result.total",
            	  records: "result.records",
            	  repeatitems: false,
            	  id: "id" 
              }
	      });
	    }	    
	    
	    //查询
	    var query = function(start, end){
	    	var postData = $("#table_list_1").jqGrid("getGridParam", "postData");
	    	var data = {};
	    	data.customerName = document.getElementById('customerName').value || '';
	    	data.salesmanName = document.getElementById('salesmanName').value || '';
	    	if(start != null && typeof start != 'undefined') {
	    		document.getElementById('submitTimeStart').value = laydate.now(start);
	    		document.getElementById('submitTimeEnd').value = laydate.now(end);
	    	}
	    	data.submitTimeStart = document.getElementById('submitTimeStart').value.trim();
	    	data.submitTimeEnd = document.getElementById('submitTimeEnd').value.trim();
	    	
	    	$.extend(postData, data);
	    	refresh();
	    }
	    
	    window.onresize = function()
	    {
	    	$("#table_list_1").setGridWidth($(window).width()-80);
	    }

	    var refresh = function()
	    {
	    	$("#table_list_1").jqGrid("setGridParam", { search: true }).trigger("reloadGrid", [{ page: 1}]);
	    }
    </script>
</body>
</html>
